#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(float_bits f)
{
	unsigned sign = f >> 31;
	unsigned exp = (f >> 23) & 0xFF;
	unsigned frac = f & 0x7FFFFF;

	int result;

	if(exp <= 126)
		return 0;

	else if(exp > 126 && exp <= 150)
	{
		frac = frac >> (150 - exp);
		//如果是负数，要有一个取补码的过程（关键一步），测试时可用0xc7ffffff测试
		if(sign)
		{
			result =((1 << 23) >> (150 - exp)) | frac;
			result = ~result + 1;
			return (sign << 31) | result;
		}
		else
			return (sign << 31) | ((1 << 23) >> (150 - exp)) | frac;
	}

	else if(exp > 150 && exp <= 157)
	{
		frac = frac << (exp - 150);
		//如果是负数，则取补码，测试时可用0xcdffffff测试
		if(sign)
		{
			result = ((1 << 23) << (exp - 150)) | frac;
			result = ~result + 1;
			return (sign << 31) | result;
		}
		else		
			return (sign << 31) | ((1 << 23) << (exp - 150)) | frac;
	}
	else
	{
		return 0x80000000;
	}
}
